﻿using Mapster;

namespace YNTK.SimpleWorkflow.Entitys.Mapper
{
    /// <summary>
    /// 通用简易工作流模型映射配置
    /// </summary>
    public class SimpleWorkflowMapper: IRegister
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="config"></param>
        public void Register(TypeAdapterConfig config)
        {
            //认情况下，无需任何配置，Mapster会根据两个实体字段名称相同进行匹配
            //如果需要更复杂的对象映射就需要通过TypeAdapterConfig配置
            config.ForType<UpdateDailyWorkRequestModel, SimpleWorkflowEntity>()
            //排除CreatorTime属性映射,相比Ignore()可以实现更细致的忽略规则
            .Ignore(new string[] {"Id","OrganizeId","MechanismId","State", 
                "CreatorTime" , "CreatorUserId", "EnabledMark" ,"LastModifyTime",
                "LastModifyUserId","DeleteMark","DeleteTime","DeleteUserId",
                "DisposeUserIds","NextDisposenNodeId","NextDisposenUserId",
                "CurrentDisposenNodeId","CurrentDisposenUserId","Index","SortCode","ViewCount"
            });
            //.IgnoreMember((memberModel, memberSide) => memberModel.Name == "CreatorTime")
            //.IgnoreMember((memberModel, memberSide) => memberModel.Name == "CreatorUserId")
            //.IgnoreMember((memberModel, memberSide) => memberModel.Name == "EnabledMark")
            //.IgnoreMember((memberModel, memberSide) => memberModel.Name == "LastModifyTime")
            //.IgnoreMember((memberModel, memberSide) => memberModel.Name == "LastModifyUserId")
            //.IgnoreMember((memberModel, memberSide) => memberModel.Name == "DeleteMark")
            //.IgnoreMember((memberModel, memberSide) => memberModel.Name == "DeleteTime")
            //.IgnoreMember((memberModel, memberSide) => memberModel.Name == "DeleteUserId");
        }
    }
}
